package com.dm.wallpaper.library.customview;

import com.dm.wallpaper.library.utils.Log;
import ohos.agp.components.AttrSet;
import ohos.agp.components.Component;
import ohos.agp.components.ListContainer;
import ohos.app.Context;
import ohos.multimodalinput.event.TouchEvent;
/*
 * Copyright (C) 2021 The Chinese Software International Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
public class MiListContenner extends ListContainer implements Component.TouchEventListener {


    public MiListContenner(Context context) {
        super(context);
    }

    public MiListContenner(Context context, AttrSet attrSet) {
        super(context, attrSet);
    }

    public MiListContenner(Context context, AttrSet attrSet, String styleName) {
        super(context, attrSet, styleName);
        setTouchEventListener(this);
    }

    @Override
    public void onTextUpdated(String text, int start, int before, int count) {
        Log.i("MiListCoxntaniner.onTextUpdated([text, start, before, count]):26");
        super.onTextUpdated(text, start, before, count);
    }

    @Override
    public void scrollTo(int position) {
        Log.i("MiListCoxntaniner.scrollTo([position]):30");
        super.scrollTo(position);
    }


    @Override
    public boolean executeItemClick(Component component, int position, long id) {
        Log.i("MiListCoxntaniner.executeItemClick([component, position, id]):40");
        return super.executeItemClick(component, position, id);
    }


    @Override
    protected void onItemSelected(ListContainer parent, Component component, int position, long id) {
        Log.i("MiListCoxntaniner.onItemSelected([parent, component, position, id]):48");
        super.onItemSelected(parent, component, position, id);
    }

    @Override
    public int getIndexForComponent(Component component) {
        Log.i("MiListCoxntaniner.getIndexForComponent([component]):54");
        return super.getIndexForComponent(component);
    }


    @Override
    public int getCenterFocusablePosition() {
        return super.getCenterFocusablePosition();
    }


    @Override
    public boolean onTouchEvent(Component component, TouchEvent touchEvent) {
        switch (touchEvent.getAction()) {
            case TouchEvent.PHASE_START:
                break;

            case TouchEvent.PHASE_MOVE:
                touchEvent.getPointerPosition(0).getY();
                break;
            case TouchEvent.PHASE_CANCEL:
                break;

        }
        return true;
    }
}


